// pages/FileView/FollowFile/FollowFile.js

var HttpRequest = require("../../../http.js"); //HTTP请求request封装

Page({

  /**
   * 页面的初始数据
   */
  data: {
    res:'',//获取的数组
    bloodImg:'../../image/Follow/blood.png',//高血压图片
    DiabetesImg:'../../image/Follow/Diabetes.png',//糖尿病图片
  },

  getReq: HttpRequest.getReq,//GET数据请求函数
  postReq: HttpRequest.postReq,//POST数据请求

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
    var that = this;
    const infoUrl = '/resident/followup/list';
    const login_Info = JSON.parse(wx.getStorageSync('login_Information')); //登录基础信息
    const headArray = wx.getStorageSync('UserLogin');
    const headmode = {
      'Accept': 'application/json',
      "Content-Type": "application/x-www-form-urlencoded",
      "headMode": headArray,
      "token": login_Info.token,
    };
    HttpRequest.getReq(infoUrl, headmode, function (res, code) {
      console.log(res);
      if(code == 200){
        that.setData({
          res: res,
        });
      }else{
        wx.showModal({
          title: '系统错误',
          content: res,
          showCancel: false,
          success:function(v){
            wx.navigateBack({
              delta: 1
            })
          }
        })
      }
     
    })
  },
  FollowFile:function(e){
    var kind = e.currentTarget.dataset.id;
    var items = e.currentTarget.dataset.item;
    console.log(kind);
    if (items == 1){
      //type值为21时代表高血压随访记录传值
      console.log(items);
      wx.navigateTo({
        url: '../../Personal/Personal?followupId=' + kind + ''
      })
    }
    else if (items == 2){
      //type值为22时代表糖尿病随访记录传值
      wx.navigateTo({
        url: '../../url/url?type=22&followupId=' + kind + ''
      })
    }
   
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})